package com.javasm.sys.controller;

import com.github.pagehelper.PageInfo;
import com.javasm.commons.base.BaseController;
import com.javasm.commons.entity.AxiosResult;
import com.javasm.commons.entity.LoginQuery;
import com.javasm.commons.enums.OperatorAction;
import com.javasm.commons.enums.OperatorType;
import com.javasm.sys.SysLoginLogService;
import com.javasm.sys.annotations.MyLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * * 登录日志混合查询
 */
@RestController
@RequestMapping("/log")
public class SysLoginLogController extends BaseController {
    @Autowired
    private SysLoginLogService sysLoginLogService;
    @PostMapping("/getLogList/{current}/{limit}")
    public AxiosResult getLogList(@PathVariable Integer current, @PathVariable Integer limit, @RequestBody(required = false) LoginQuery loginQuery){
        PageInfo loginInfo = sysLoginLogService.getLoginInfo(loginQuery,current,limit);
        return suc(loginInfo);
    }
    @DeleteMapping("/batchDelete")
    @MyLog(title = "日志模块",operationAction = OperatorAction.DELETE,operatorType = OperatorType.MANAGE)
    public AxiosResult batchDelete(Integer[] ids){
        sysLoginLogService.batchDeleteLog(ids);
        return suc();
    }

}
